<script setup>
import { ref } from 'vue'

const showRightPanel = ref(false)

function toggleRightPanel() {
  showRightPanel.value =!showRightPanel.value
}
</script>
<template>
  <div class="open-right-panel">
    <div class="right-panel-btn" @click="toggleRightPanel()">
      <i class="fa fa-cog"></i>
      <span>信息</span>
      </div>
  </div>
  <transition name="el-fade-in-linear">
    <div class="right-panel" v-show="showRightPanel" >
      <div class="right-panel-header">
        <span>Right Panel</span>
        <div class="right-panel-close-btn" @click="toggleRightPanel()">
          <i class="fa fa-times"></i>
          <span>Close</span>
        </div>
      </div>
      <div class="right-panel-content">
        <p>This is the right panel content</p>
      </div>
    </div>
  </transition>
</template>
<style lang="scss" scoped>
.right-panel {
  height: 100%;
  width: 300px;
  background-color: #f5f5f5;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9;

  .right-panel-header {
    background-color: #0488f6;
    color: #fff;
    padding: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;

    span {
      font-size: 14px;
      //font-weight: bold;
    }

    i {
      font-size: 24px;
      cursor: pointer;
    }
  }

  .right-panel-content {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
  }
}
.open-right-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9;
  padding: 5px;
  cursor: pointer;

  .right-panel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0574d2;
    color: #fff;
    padding: 5px;
    border-radius: 5px;
    //margin-bottom: 5px;

    i {
      margin-right: 5px;
    }
  }
}
</style>